package com.qf.air.config;

import org.apache.http.HttpHost;
import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestHighLevelClient;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author 何星宇
 * @version V1.0
 * @Date 2021/11/5 19:21
 */

@Configuration
public class ElasticsearchConfig {

//    @Value("${spring.elasticsearch.jest.proxy.host}")
    private String host="49.232.84.211";
//    @Value("${spring.elasticsearch.jest.proxy.port}")
    private int port=9200;

    @Bean
    public RestHighLevelClient restHighLevelClient(){
        HttpHost httpHost = new HttpHost(host,port);
        return new RestHighLevelClient(RestClient.builder(httpHost));
    }
}
